package com.food.eat.config;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.sql.Struct;

@Slf4j
public class StragetyCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata annotatedTypeMetadata) {
        Environment environment = context.getEnvironment();
        String property = environment.getProperty("strategy.method");
        log.info("当前加载的方法为：Strategy"+property+"Impl");
        if(!StringUtils.isBlank(property)) {
            return true;
        }
        return false;
    }
}
